import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

a0 = [[1, 2, 3], [1, 2, 4]]
a1 = np.array(a0)
# shape ,则各维度的大小
row_index = ["股票{}".format(i) for i in range(a1.shape[0])]
# 时间函数需要熟悉，生活在一维的世界
col_index = pd.date_range(start='20200802', periods=a1.shape[1], freq="B")
# index 指行索引； columns 指列索引
a2 = pd.DataFrame(a1, index=row_index, columns=col_index)

print(a2, a2.shape, a2.index, a2.columns, a2.T)
print(a2.head(3), a2.tail(1))

b1 = ["Hello,Hi", "您好,你好", "你好,Hello"]
b10 = [i.split(",") for i in b1]
print(b10)
b11 = [j for i in b10 for j in i]
print(b11)
col_index1 = np.unique(b11)
print(np.unique(b11))
# col_index1.shape[0]
zeros = np.zeros((col_index1.shape[0], 10))
print(zeros)
pdD = pd.DataFrame(np.array(zeros), index=col_index1, columns=np.random.rand(10))
print(pdD)
